package com.paipaideli.ui.home.adapter.model;


import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.paipaideli.R;
import com.paipaideli.common.views.UPMarqueeView;
import com.paipaideli.ui.home.bean.HomeBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by wangjia on 2017/8/4.
 * TODO("TT 头条 ")
 */

public class UpMarqueeModel extends FrameLayout {

    Context context;
    List<View> views = new ArrayList<>();

    @BindView(R.id.upMarqueeView)
    UPMarqueeView upMarqueeView;

    public UpMarqueeModel(@NonNull Context context) {
        super(context);
        this.context = context;
        views.clear();
        init();
    }

    public UpMarqueeModel(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        views.clear();
        init();
    }

    public UpMarqueeModel(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        views.clear();
        init();
    }


    public void init() {
        View inflate = View.inflate(context, R.layout.home_upmarquee_item, this);
        ButterKnife.bind(inflate);
    }

//    public void setDate(List<HomeBean.Data.Notices> date) {
//        for (int i = 0; i < date.size(); i=i+2) {
//            //设置滚动的单个布局
//            LinearLayout moreView = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.home_upmarquee, null);
//            //初始化布局的控件
//            TextView tv1 = moreView.findViewById(R.id.text_head_lines_view);
////            TextView tv2 = moreView.findViewById(R.id.text_head_lines_view2);
////            LinearLayout lin_message_2 = moreView.findViewById(R.id.lin_message_2);
//            //进行对控件赋值
////            tv1.setText(ttNews.get(i).getTitle());
//            tv1.setText(date.get(i).toString());
//
////            if (ttNews.size() > i + 1) {
////                lin_message_2.setVisibility(View.VISIBLE);
////                tv2.setText(ttNews.get(i + 1).getTitle());
////            } else {
////                lin_message_2.setVisibility(View.INVISIBLE);
////            }
////            int index = i;
//            //添加到循环滚动数组里面去
//            views.add(moreView);
//        }
//        upMarqueeView.setViews(views);
//    }
}
